#ifndef CONVERT_H
#define CONVERT_H

#include <QObject>
#include <QThread>
#include <QWidget>
#include <QFileDialog>
#include <QString>
#include <QDebug>
#include <QDirIterator>
#include <QStringListIterator>
#include <QProcess>
#include <QFile>
#include <QJsonParseError>
#include <QJsonObject>
#include <QMessageBox>
#include <QTimer>
#include <QIcon>
#include <QDesktopServices>
#include <QMouseEvent>
#include <QUuid>
#include <QDateTime>

#include "exec_worker.h"
#include "my_click_label.h"
#include "videoinfo.h"

#define TIMER_TIMEOUT	(3*1000)

namespace Ui {
class Convert;
}

class Convert : public QWidget
{
Q_OBJECT

    QThread workerThread;

public:
    explicit Convert(QWidget *parent = 0);
    ~Convert();

private slots:
    void on_sourcePathBtn_pressed();

    void on_targetPathBtn_pressed();

    void on_convertBtn_pressed();

    void on_clearLog_pressed();

    void on_btnBilibili_pressed();
    // 处理子线程执行的结果
    void handleResults(QString result, QString metaStr);
    void convertBilibiliVideoToMp4(QString sourcePath, QString targetPath);
    void handleTimeout();
    bool checkInput();
    void handleMouseReleaseEvent();
    void handleFFmpegProcess(qint64 p);
    void handleFFmpegFinish();

signals:
    // 发送信号，触发线程
    void operate(QStringList cmd, QString metaStr);

private:
    Ui::Convert *ui;
    QTimer *m_pTimer;
};

#endif // CONVERT_H
